<script setup lang="ts">
interface Props {
  data?: {
    buildingTotal: number
    enterpriseTotal: number
    chargePoleTotal: number
    parkingTotal: number
  }
}

const props = defineProps<Props>()
</script>

<template>
  <div class="park-info-container">
    <div class="park-grid">
      <div class="park-item">
        <div class="park-number">
          {{ props.data?.buildingTotal || 0 }}
        </div>
        <img src="/public/assets/building-icon.png" alt="楼宇总数" class="park-icon">
        <div class="park-label">
          楼宇总数
        </div>
      </div>
      <div class="park-item">
        <div class="park-number">
          {{ props.data?.enterpriseTotal || 0 }}
        </div>
        <img src="/public/assets/building-icon.png" alt="企业总数" class="park-icon">
        <div class="park-label">企业总数</div>
      </div>
      <div class="park-item">
        <div class="park-number">
          {{ props.data?.parkingTotal || 0 }}
        </div>
        <img src="/public/assets/building-icon.png" alt="车位总数" class="park-icon">
        <div class="park-label">车位总数</div>
      </div>
      <div class="park-item">
        <div class="park-number">
          {{ props.data?.chargePoleTotal || 0 }}
        </div>
        <img src="/public/assets/building-icon.png" alt="充电桩总数" class="park-icon">
        <div class="park-label">充电桩总数</div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.park-info-container {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.park-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  width: 100%;
}

.park-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
  min-height: 120px;
  
  &:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
  }
}

.park-number {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  line-height: 1;
}

.park-icon {
  width: 32px;
  height: 32px;
  margin: 8px 0;
  object-fit: contain;
}

.park-label {
  font-size: 14px;
  color: #666;
  text-align: center;
  line-height: 1.2;
  margin-top: 5px;
}

// 响应式设计
@media (max-width: 768px) {
  .park-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .park-item {
    min-height: 100px;
    padding: 10px 5px;
  }
  
  .park-number {
    font-size: 20px;
  }
  
  .park-icon {
    width: 28px;
    height: 28px;
  }
  
  .park-label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .park-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .park-item {
    min-height: 80px;
    padding: 8px 4px;
  }
  
  .park-number {
    font-size: 18px;
  }
  
  .park-icon {
    width: 24px;
    height: 24px;
  }
  
  .park-label {
    font-size: 11px;
  }
}

@media (min-width: 1200px) {
  .park-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .park-item {
    min-height: 140px;
  }
  
  .park-number {
    font-size: 28px;
  }
  
  .park-icon {
    width: 36px;
    height: 36px;
  }
  
  .park-label {
    font-size: 15px;
  }
}
</style>
